<template>
  <div>
    <el-row :gutter="20">
       <el-col :span="12">

      </el-col>
    </el-row>
     <el-row :gutter="20">
      <el-col :span="11">
        <div  id='chart'  style="height:450px;width:600px "></div>
      </el-col>
      <el-col :span="12">
        <div id="chart2" style="height:450px;width:600px "></div>
      </el-col>
    </el-row>
  </div>
</template>

<script>
import * as echarts from 'echarts'
// 基于准备好的dom，初始化echarts实例
export default {
  mounted () {
    var myChart = echarts.init(document.getElementById('chart'))
    // 绘制图表
    myChart.setOption({
      title: {
        text: '本周收入和支出',
        subtext: '对比',
        left: 'center'
      },
      tooltip: {
        trigger: 'item'
      },
      legend: {
        orient: 'vertical',
        left: 'left'
      },
      series: [
        {
          name: 'Access From',
          type: 'pie',
          radius: '50%',
          data: [
            { value: 30000, name: '收入' },
            { value: 59530, name: '支出' }
          ],
          emphasis: {
            itemStyle: {
              shadowBlur: 10,
              shadowOffsetX: 0,
              shadowColor: 'rgba(0, 0, 0, 0.5)'
            }
          }
        }
      ]
    })
    var myChart2 = echarts.init(document.getElementById('chart2'))
    // 绘制图表
    myChart2.setOption({
      title: {
        text: '本周收入和支出'
      },
      tooltip: {
        trigger: 'axis'
      },
      legend: {
        data: ['收入', '支出', 'Video Ads', 'Direct', 'Search Engine']
      },
      grid: {
        left: '3%',
        right: '4%',
        bottom: '3%',
        containLabel: true
      },
      toolbox: {
        feature: {
          saveAsImage: {}
        }
      },
      xAxis: {
        type: 'category',
        boundaryGap: false,
        data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
      },
      yAxis: {
        type: 'value'
      },
      series: [
        {
          name: 'Email',
          type: 'line',
          stack: 'Total',
          data: [120, 132, 101, 134, 90, 230, 210]
        },
        {
          name: 'Union Ads',
          type: 'line',
          stack: 'Total',
          data: [220, 182, 191, 234, 290, 330, 310]
        }]
    })
  }
}
</script>

<style scoped>
.el-row{
  margin: 20px;
  padding: 0px;
}
.bg-purple {
    background: white;
    border-radius: 20px;
    color: #999;
    font-size: 25px;
    text-align: center;
    line-height: 30px;
    padding: 20px;
  }
.charts{
  background-color: white;
}
</style>
